<?php

namespace app\commons\model;

use think\Model;
use think\model\concern\SoftDelete;

class Material extends Model
{
    use SoftDelete;

    protected $deleteTime = 'delete_time';

//    protected $auto = ['type_text','status_text','is_upload_yun_text'];

    /**
     * 类型中文
     * @param $value
     * @param $data
     * @return string
     */
    public function getTypeTextAttr($value,$data){
        $type = [
            0=>'视频',
            1=>'音频',
            2=>'图片',
        ];
        return $type[$data['status']];
    }

    /**
     * 状态中文
     * @param $value
     * @param $data
     * @return string
     */
    public function getIsUploadYunTextAttr($value,$data){
        $status = [
            0=>'未上传',
            1=>'已完成'
        ];
        return $status[$data['status']];
    }

}